﻿using RTW.Core.Ioc;
using RTW.Core.Repository;
using RTW.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace RTW.Servers
{
    public class Userlistserver : BaseServers<SysUserlist>, IAutoInject
    {
        private readonly IRepositoryAsync<SysUserlist> SysUserRepository;
        public Userlistserver()
        {
            SysUserRepository = new DapperAsyncRepository<SysUserlist>();
        }

        /// <summary>
        /// 根据单位ID获取数据
        /// </summary>
        /// <param name="DWID"></param>
        /// <returns></returns>
        public async Task<List<SysUserlist>> GetUserWhere(int? DWID)
        {
            return (await SysUserRepository.SqlWithParams("select a.*,c.RMC,d.BMMC from ((Sys_User a left join Sys_User_Role b on a.YHID = b.YHID) left join Sys_Role c on b.rid = c.rid) left join Sys_Dept d on a.bmid = d.bmid where a.dwid = :DWID", new { DWID = DWID })).ToList();
        }
    }
}
